package org.example.compent;

import com.alibaba.fastjson.JSON;
import com.yomahub.liteflow.annotation.LiteflowComponent;
import com.yomahub.liteflow.annotation.LiteflowMethod;
import com.yomahub.liteflow.core.NodeComponent;
import com.yomahub.liteflow.enums.LiteFlowMethodEnum;
import com.yomahub.liteflow.enums.NodeTypeEnum;
import com.yomahub.liteflow.slot.DefaultContext;
import lombok.extern.slf4j.Slf4j;

@Slf4j
@LiteflowComponent
public class SwitchCmp {
	@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_SWITCH, nodeId = "switch", nodeType = NodeTypeEnum.SWITCH)
	public String processSwitch(NodeComponent component)  {
		DefaultContext contextBean = component.getContextBean(DefaultContext.class);
		log.info("content:{}", JSON.toJSON(contextBean));
		String b = contextBean.getData("b").toString();
		log.info("b:{}", b);
		log.info("--------C判断结点----------");
		String type = contextBean.getData("type").toString();
		contextBean.setData("c", type);
		return type;
	}
}
